package test.src.awt_swing;

import java.awt.*;

public class GridLayoutDemo {
    public static void main(String[] args) {
        Frame frame = new Frame("计算器效果图");
        frame.setLayout(new BorderLayout());
        Panel panel = new Panel();
        panel.setLayout(new GridLayout(3, 5, 4, 4));
        String s = "0123456789+-*/.";
        char[] chars = s.toCharArray();
        int mark = 0;
        for (int i = 0; i < 15; i++) {
            panel.add(new Button("" + chars[mark]));
            mark++;
        }
        frame.add(new TextField(30), BorderLayout.NORTH);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
    }
}
